/*
Copyright (C) Ariff Ehsan, Abdul Hadi Fikri

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

/*  Author : Ariff Ehsan
 *  Date   : Jan 12, 2010
 *
 *  Info   : - Library KEYPADD44 is used for scanning a 4x4 keypad module.
 *           - All pins MUST be connected to the same port.
 *           - Input pins MUST be connected to LSB pins, while Output pins
 *             MUST be connected to MS pins.
 */


#ifndef __KEYPAD44_H__
#define __KEYPAD44_H__


#ifndef KEYPAD44_PORT
#error KEYPAD44_PORT is not defined
#endif


#ifndef KEYPAD44_DDR
#error KEYPAD44_DDR is not defined
#endif


#ifndef KEYPAD44_PIN
#error KEYPAD44_PIN is not defined
#endif


#ifndef KEYPAD44_SCAN_RATE
#define KEYPAD44_SCAN_RATE 10 // milliseconds
#endif


enum keypad44_state_enums {
	
	KEYPAD44_STATE_RELEASED = 0,
	KEYPAD44_STATE_RELEASING,
	KEYPAD44_STATE_PUSHED,
	KEYPAD44_STATE_PUSHING,
};


void KEYPAD44_init(void);
void KEYPAD44_reg(void (*event)(uint8_t, uint8_t, uint8_t));


#endif // __KEYPAD44_H__


